-
Notifications
You must be signed in to change notification settings - Fork 7.6k
esp32-hal-ledc.c: Clear bit in used_channels bitmap #10089
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Hello nuclearcat, we appreciate your contribution to this project! Click to see more instructions ...
Review and merge process you can expect ...
|
Test Results 56 files - 83 56 suites - 83 4m 51s ⏱️ - 1h 38m 0s Results for commit 9f3a11a. ± Comparison against base commit f5be003. This pull request removes 9 tests.
♻️ This comment has been updated with latest results. |
Memory usage test (comparing PR against master branch)The table below shows the summary of memory usage change (decrease - increase) in bytes and percentage for each target.
Click to expand the detailed deltas report [usage change in BYTES]
|
When we attach pin to LEDC channel we set bit in used_channels bitmap variable. But used_channels bit was not cleared on detach, as result simply repeating attach/detach around 16 times will falsely use all available channels and emit error that channel is not available. This happen for example in IRSenderESP32.cpp. This patch fixes this bug. Signed-off-by: Denys Fedoryshchenko <[email protected]>
bc7042a
to
9f3a11a
Compare
Hello @nuclearcat, thank you very much for providing a PR and reporting the issue. |
When we attach pin to LEDC channel we set bit in used_channels bitmap variable. But used_channels bit was not cleared on detach,
as result simply repeating attach/detach around 16 times will falsely use all available channels and
emit error that channel is not available.
This happen for example in IRSenderESP32.cpp.
This patch fixes this bug.
Sorry for not providing issue, as it require filling big amount of irrelevant form fields for just 2 lines of code.
To reproduce issue enable verbose debug and run in loop:
ledcAttach(13, 12000, 8);
ledcDetach(13);
It will fail, as i recall after 15 or 16th loop cycle.